<?php
namespace Admin\Controller;
use Think\Controller;
class UserController extends CommonController {
    public function index(){
    	if(IS_AJAX){
            $model = M("User");
            $map = array();

            $res['count'] = $model->where($map)->count();
            $page = $_GET['page']?$_GET['page']:1;
            $limit = $_GET['limit']?$_GET['limit']:10;
            $res['list'] = $model->where($map)->page("{$page},{$limit}")->select();

            $this->ajaxReturn($res);
        }else{
            $this->display();
        }  
    }

    public function xian(){
        $model = M("User");
        $map['uid'] = $_POST['id'];

        $new['status'] = $_POST['status'];
        if($model->where($map)->save($new)){
            $this->success("设置成功！");
        }else{
            $this->error("网络忙，请稍后再试！".$model->getLastSql());
        }
    }
}